home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / dsm.inc < prev    next >
Encoding:
Text File  |  1997-01-16  |  26.7 KB  |  902 lines

  1. ;*      DSM.INC
  2. ;*
  3. ;* Digital Sound Mixer
  4. ;*
  5. ;* $Id: dsm.inc,v 1.5 1997/01/16 18:41:59 pekangas Exp $
  6. ;*
  7. ;* Copyright 1996,1997 Housemarque Inc.
  8. ;*
  9. ;* This file is part of the MIDAS Sound System, and may only be
  10. ;* used, modified and distributed under the terms of the MIDAS
  11. ;* Sound System license, LICENSE.TXT. By continuing to use,
  12. ;* modify or distribute this file you indicate that you have
  13. ;* read the license and understand and accept it fully.
  14. ;*
  15.  
  16.  
  17. VOLLEVELS = 33                          ; total number of volume levels
  18. VOLSHIFT = 1                ; amount to shift volume right
  19. VOLADD = 1                ; amount to add to volume before
  20.                     ; shifting - used to round up
  21.  
  22. DSM_SMP_STREAM = MAXSAMPLES             ; magic sample handle for streams
  23.  
  24.  
  25.  
  26. ;/***************************************************************************\
  27. ;*      enum dsmMixMode
  28. ;*      ---------------
  29. ;* Description: Available DSM mixing modes
  30. ;\***************************************************************************/
  31.  
  32. ENUM    dsmMixMode \
  33.         dsmMixMono = 1, \               ; mono mixing
  34.         dsmMixStereo = 2                ; stereo mixing
  35.  
  36.  
  37.  
  38.  
  39. ;/***************************************************************************\
  40. ;*      enum dsmChanStatus
  41. ;*      ------------------
  42. ;* Description: DSM channel sound playing status
  43. ;\***************************************************************************/
  44.  
  45. ENUM    dsmChanStatus \
  46.         dsmChanStopped = 0, \           ; playing is stopped
  47.         dsmChanEnd, \                   ; playing has ended (not forced
  48.         \                               ; stopped
  49.         dsmChanPlaying, \               ; playing, not released
  50.         dsmChanReleased                 ; playing, note has been released
  51.  
  52.  
  53.  
  54.  
  55. ;/***************************************************************************\
  56. ;*      enum dsmPlayDir
  57. ;*      ---------------
  58. ;* Description: Playing direction in bidirectional loops
  59. ;\***************************************************************************/
  60.  
  61. ENUM    dsmPlayDir \
  62.         dsmPlayBackwards = -1, \        ; playing backwards
  63.         dsmPlayForwards = 1             ; playing forward
  64.  
  65.  
  66.  
  67.  
  68. ;/***************************************************************************\
  69. ;*      struct dsmChannel
  70. ;*      -----------------
  71. ;* Description: DSM channel data
  72. ;\***************************************************************************/
  73.  
  74. STRUC   dsmChannel
  75.         D_ptr   sample                  ; sample data pointer
  76.         D_int   sampleType              ; sample type, see enum sdSampleType
  77.         D_int   samplePos               ; sample position in memory
  78.         D_int   sampleLength            ; sample length
  79.         D_int   loopMode                ; sample looping mode, see enum
  80.                                         ; sdLoopMode
  81.         D_int   loop1Start              ; first loop start
  82.         D_int   loop1End                ; first loop end
  83.         D_int   loop1Type               ; first loop type, see enum sdLoopType
  84.         D_int   loop2Start              ; second loop start
  85.         D_int   loop2End                ; second loop end
  86.         D_int   loop2Type               ; second loop type
  87.  
  88.         D_int   playPos                 ; playing position whole part
  89.         D_int   playPosLow              ; playing position fractional part
  90.                                         ; (only lower 16 bits used)
  91.         D_int   streamWritePos;         ; stream write position
  92.         rate    DD      ?               ; playing rate in Hz
  93.         D_int   direction               ; playing direction in bidirectional
  94.                                         ; loops - 1 is forward, -1 back
  95.         D_int   sampleHandle            ; sample handle
  96.         D_int   sampleChanged           ; 1 if sample has been changed
  97.                                         ; but values not yet set in
  98.                                         ; channel struct
  99.         D_int   panning                 ; panning information
  100.         D_int   volume                  ; playing volume (0-64)
  101.         D_int   muted                   ; 1 if channel muted, 0 if not
  102.         D_int   status                  ; channel status, see enum dsm
  103.                                         ; dsmChanStatus
  104.         D_int   loopNum                 ; currently played sample loop
  105.         D_ptr   loopCallback            ; looping callback function
  106. ENDS
  107.  
  108.  
  109.  
  110.  
  111. ;/***************************************************************************\
  112. ;*      struct dsmSample
  113. ;*      ----------------
  114. ;* Description: DSM internal sample structure
  115. ;\***************************************************************************/
  116.  
  117. STRUC   dsmSample
  118.         D_ptr   sample                  ; sample data pointer
  119.         D_int   sampleType              ; sample type, see enum sdSampleType
  120.         D_int   samplePos               ; sample position in memory
  121.         D_int   sampleLength            ; sample length
  122.         D_int   loopMode                ; sample looping mode, see enum
  123.                                         ; sdLoopMode
  124.         D_int   loop1Start              ; first loop start
  125.         D_int   loop1End                ; first loop end
  126.         D_int   loop1Type               ; first loop type, see enum sdLoopType
  127.         D_int   loop2Start              ; second loop start
  128.         D_int   loop2End                ; second loop end
  129.         D_int   loop2Type               ; second loop type
  130.  
  131.         D_int   inUse                   ; 1 if sample is in use, 0 if not
  132.                                         ; (removed using dsmRemoveSample)
  133.         D_int   copied                  ; 1 if a copied sample (should be
  134.                                         ; deallocated), 0 if not
  135. ENDS
  136.  
  137.  
  138.  
  139. GLOBAL  LANG dsmMixBuffer : _ptr        ; DSM mixing buffer. dsmPlay()
  140.                                         ; writes the mixed data here. Post-
  141.                                         ; processing is usually necessary.
  142. GLOBAL  LANG dsmMixBufferSize : _int    ; DSM mixing buffer size
  143.  
  144. ; The following global variables are used internally by different DSM
  145. ; functions and should not be accessed by other modules:
  146.  
  147. GLOBAL  LANG dsmMixRate : _int          ; mixing rate in Hz
  148. GLOBAL  LANG dsmMode : _int             ; output mode (see enum dsmMixMode)
  149. IFDEF __16__
  150. GLOBAL  LANG dsmVolTableSeg : word      ; volume table segment
  151. ENDIF
  152. GLOBAL  LANG dsmVolumeTable : _ptr      ; pointer to volume table
  153.  
  154. GLOBAL  LANG dsmChannels : _ptr         ; pointer to channel datas
  155. GLOBAL  LANG dsmSamples : _ptr          ; sample structures
  156. GLOBAL  LANG dsmOutputBits : _int       ; output bit width
  157.  
  158.  
  159.  
  160.  
  161. ;/***************************************************************************\
  162. ;*
  163. ;* Function:    int dsmInit(unsigned mixRate, unsigned mode,
  164. ;*                  unsigned outputBits);
  165. ;*
  166. ;* Description: Initializes Digital Sound Mixer
  167. ;*
  168. ;* Input:       unsigned mixRate        mixing rate in Hz
  169. ;*              unsigned mode           mixing mode (see enum dsmMixMode)
  170. ;*              unsigned outputBits     output bit width (if less than
  171. ;*                                      16, output values are divided
  172. ;*                                      accordingly - mixing buffer is
  173. ;*                                      always a sequence of unsigned ints)
  174. ;*
  175. ;* Returns:     MIDAS error code
  176. ;*
  177. ;\***************************************************************************/
  178.  
  179. GLOBAL  LANG dsmInit : _funct
  180.  
  181.  
  182.  
  183.  
  184. ;/***************************************************************************\
  185. ;*
  186. ;* Function:    int dsmClose(void)
  187. ;*
  188. ;* Description: Uninitializes Digital Sound Mixer
  189. ;*
  190. ;* Returns:     MIDAS error code
  191. ;*
  192. ;\***************************************************************************/
  193.  
  194. GLOBAL  LANG dsmClose : _funct
  195.  
  196.  
  197.  
  198.  
  199. ;/***************************************************************************\
  200. ;*
  201. ;* Function:    int dsmGetMixRate(unsigned *mixRate)
  202. ;*
  203. ;* Description: Reads the actual mixing rate
  204. ;*
  205. ;* Input:       unsigned *mixRate       pointer to mixing rate variable
  206. ;*
  207. ;* Returns:     MIDAS error code.
  208. ;*              Mixing rate, in Hz, is stored in *mixRate
  209. ;*
  210. ;\***************************************************************************/
  211.  
  212. GLOBAL  LANG dsmGetMixRate : _funct
  213.  
  214.  
  215.  
  216.  
  217. ;/***************************************************************************\
  218. ;*
  219. ;* Function:    int dsmOpenChannels(unsigned channels);
  220. ;*
  221. ;* Description: Opens channels for output
  222. ;*
  223. ;* Input:       unsigned channels       number of channels to open
  224. ;*
  225. ;* Returns:     MIDAS error code
  226. ;*
  227. ;\***************************************************************************/
  228.  
  229. GLOBAL  LANG dsmOpenChannels : _funct
  230.  
  231.  
  232.  
  233.  
  234. ;/***************************************************************************\
  235. ;*
  236. ;* Function:    int dsmCalcVolTable(unsigned amplification)
  237. ;*
  238. ;* Description: Calculates a new volume table
  239. ;*
  240. ;* Input:       unsigned amplification  Amplification level. 64 - normal
  241. ;*                                      (100%), 32 = 50%, 128 = 200% etc.
  242. ;*
  243. ;* Returns:     MIDAS error code
  244. ;*
  245. ;\***************************************************************************/
  246.  
  247. GLOBAL  LANG dsmCalcVolTable : _funct
  248.  
  249.  
  250.  
  251.  
  252. ;/***************************************************************************\
  253. ;*
  254. ;* Function:    int dsmCloseChannels(void)
  255. ;*
  256. ;* Description: Closes open output channels
  257. ;*
  258. ;* Returns:     MIDAS error code
  259. ;*
  260. ;\***************************************************************************/
  261.  
  262. GLOBAL  LANG dsmCloseChannels : _funct
  263.  
  264.  
  265.  
  266.  
  267. ;/***************************************************************************\
  268. ;*
  269. ;* Function:    int dsmClearChannels(void)
  270. ;*
  271. ;* Description: Clears open channels (removes all sounds)
  272. ;*
  273. ;* Returns:     MIDAS error code
  274. ;*
  275. ;\***************************************************************************/
  276.  
  277. GLOBAL  LANG dsmClearChannels : _funct
  278.  
  279.  
  280.  
  281.  
  282. ;/***************************************************************************\
  283. ;*
  284. ;* Function:    int dsmMute(int mute)
  285. ;*
  286. ;* Description: Mutes all channels
  287. ;*
  288. ;* Input:       int mute                1 = mute, 0 = un-mute
  289. ;*
  290. ;* Returns:     MIDAS error code
  291. ;*
  292. ;\***************************************************************************/
  293.  
  294. GLOBAL  LANG dsmMute : _funct
  295.  
  296.  
  297.  
  298.  
  299. ;/***************************************************************************\
  300. ;*
  301. ;* Function:    int dsmPause(int pause)
  302. ;*
  303. ;* Description: Pauses or resumes playing
  304. ;*
  305. ;* Input:       int pause               1 = pause, 0 = resume
  306. ;*
  307. ;* Returns:     MIDAS error code
  308. ;*
  309. ;\***************************************************************************/
  310.  
  311. GLOBAL  LANG dsmPause : _funct
  312.  
  313.  
  314.  
  315.  
  316. ;/***************************************************************************\
  317. ;*
  318. ;* Function:    int dsmSetMasterVolume(unsigned masterVolume)
  319. ;*
  320. ;* Description: Sets the master volume
  321. ;*
  322. ;* Input:       unsigned masterVolume   master volume (0 - 64)
  323. ;*
  324. ;* Returns:     MIDAS error code
  325. ;*
  326. ;\***************************************************************************/
  327.  
  328. GLOBAL  LANG dsmSetMasterVolume : _funct
  329.  
  330.  
  331.  
  332.  
  333. ;/***************************************************************************\
  334. ;*
  335. ;* Function:    int dsmGetMasterVolume(unsigned *masterVolume)
  336. ;*
  337. ;* Description: Reads the master volume
  338. ;*
  339. ;* Input:       unsigned *masterVolume  pointer to master volume
  340. ;*
  341. ;* Returns:     MIDAS error code. Master volume is written to *masterVolume.
  342. ;*
  343. ;\***************************************************************************/
  344.  
  345. GLOBAL  LANG dsmGetMasterVolume : _funct
  346.  
  347.  
  348.  
  349.  
  350. ;/***************************************************************************\
  351. ;*
  352. ;* Function:    int dsmSetAmplification(unsigned amplification)
  353. ;*
  354. ;* Description: Sets amplification level and calculates new volume table.
  355. ;*
  356. ;* Input:       unsigned amplification  amplification level, 64 = normal
  357. ;*
  358. ;* Returns:     MIDAS error code
  359. ;*
  360. ;\***************************************************************************/
  361.  
  362. GLOBAL  LANG dsmSetAmplification : _funct
  363.  
  364.  
  365.  
  366.  
  367. ;/***************************************************************************\
  368. ;*
  369. ;* Function:    int dsmGetAmplification(unsigned *amplification)
  370. ;*
  371. ;* Description: Reads the amplification level
  372. ;*
  373. ;* Input:       unsigned *amplification   pointer to amplification level
  374. ;*
  375. ;* Returns:     MIDAS error code. Amplification level is written to
  376. ;*              *amplification.
  377. ;*
  378. ;\***************************************************************************/
  379.  
  380. GLOBAL  LANG dsmGetAmplification : _funct
  381.  
  382.  
  383.  
  384.  
  385. ;/***************************************************************************\
  386. ;*
  387. ;* Function:    int dsmPlaySound(unsigned channel, ulong rate)
  388. ;*
  389. ;* Description: Starts playing a sound
  390. ;*
  391. ;* Input:       unsigned channel        channel number
  392. ;*              ulong rate              playing rate in Hz
  393. ;*
  394. ;* Returns:     MIDAS error code
  395. ;*
  396. ;\***************************************************************************/
  397.  
  398. GLOBAL  LANG dsmPlaySound : _funct
  399.  
  400.  
  401.  
  402.  
  403. ;/***************************************************************************\
  404. ;*
  405. ;* Function:    int dsmReleaseSound(unsigned channel)
  406. ;*
  407. ;* Description: Releases the current sound from the channel. If sdLoop1Rel or
  408. ;*              sdLoop2 looping modes are used, playing will be continued from
  409. ;*              the release part of the current sample (data after the end
  410. ;*              of the first loop) after the end of the first loop is reached
  411. ;*              next time, otherwise the sound will be stopped.
  412. ;*
  413. ;* Input:       unsigned channel        channel number
  414. ;*
  415. ;* Returns:     MIDAS error code
  416. ;*
  417. ;\***************************************************************************/
  418.  
  419. GLOBAL  LANG dsmReleaseSound : _funct
  420.  
  421.  
  422.  
  423.  
  424. ;/***************************************************************************\
  425. ;*
  426. ;* Function:    int dsmStopSound(unsigned channel)
  427. ;*
  428. ;* Description: Stops playing a sound
  429. ;*
  430. ;* Input:       unsigned channel        channel number
  431. ;*
  432. ;* Returns:     MIDAS error code
  433. ;*
  434. ;\***************************************************************************/
  435.  
  436. GLOBAL  LANG dsmStopSound : _funct
  437.  
  438.  
  439.  
  440.  
  441. ;/***************************************************************************\
  442. ;*
  443. ;* Function:    int dsmSetRate(unsigned channel, ulong rate)
  444. ;*
  445. ;* Description: Sets the playing rate
  446. ;*
  447. ;* Input:       unsigned channel        channel number
  448. ;*              ulong rate              playing rate in Hz
  449. ;*
  450. ;* Returns:     MIDAS error code
  451. ;*
  452. ;\***************************************************************************/
  453.  
  454. GLOBAL  LANG dsmSetRate : _funct
  455.  
  456.  
  457.  
  458.  
  459. ;/***************************************************************************\
  460. ;*
  461. ;* Function:    int dsmGetRate(unsigned channel, ulong *rate)
  462. ;*
  463. ;* Description: Reads the playing rate on a channel
  464. ;*
  465. ;* Input:       unsigned channel        channel number
  466. ;*              ulong *rate             pointer to playing rate
  467. ;*
  468. ;* Returns:     MIDAS error code. Playing rate is written to *rate, 0 if
  469. ;*              no sound is being played.
  470. ;*
  471. ;\***************************************************************************/
  472.  
  473. GLOBAL  LANG dsmGetRate : _funct
  474.  
  475.  
  476.  
  477.  
  478. ;/***************************************************************************\
  479. ;*
  480. ;* Function:    int dsmSetVolume(unsigned channel, unsigned volume)
  481. ;*
  482. ;* Description: Sets the playing volume
  483. ;*
  484. ;* Input:       unsigned channel        channel number
  485. ;*              unsigned volume         playing volume (0-64)
  486. ;*
  487. ;* Returns:     MIDAS error code
  488. ;*
  489. ;\***************************************************************************/
  490.  
  491. GLOBAL  LANG dsmSetVolume : _funct
  492.  
  493.  
  494.  
  495.  
  496. ;/***************************************************************************\
  497. ;*
  498. ;* Function:    int dsmGetVolume(unsigned channel, unsigned *volume)
  499. ;*
  500. ;* Description: Reads the playing volume
  501. ;*
  502. ;* Input:       unsigned channel        channel number
  503. ;*              unsigned *volume        pointer to volume
  504. ;*
  505. ;* Returns:     MIDAS error code. Playing volume is written to *volume.
  506. ;*
  507. ;\***************************************************************************/
  508.  
  509. GLOBAL  LANG dsmGetVolume : _funct
  510.  
  511.  
  512.  
  513.  
  514. ;/***************************************************************************\
  515. ;*
  516. ;* Function:    int dsmSetSample(unsigned channel, unsigned smpHandle)
  517. ;*
  518. ;* Description: Sets the sample number on a channel
  519. ;*
  520. ;* Input:       unsigned channel        channel number
  521. ;*              unsigned smpHandle      sample handle returned by
  522. ;*                                      dsmAddSample()
  523. ;*
  524. ;* Returns:     MIDAS error code
  525. ;*
  526. ;\***************************************************************************/
  527.  
  528. GLOBAL  LANG dsmSetSample : _funct
  529.  
  530.  
  531.  
  532.  
  533. ;/***************************************************************************\
  534. ;*
  535. ;* Function:    int dsmGetSample(unsigned channel, unsigned *smpHandle)
  536. ;*
  537. ;* Description: Reads current sample handle
  538. ;*
  539. ;* Input:       unsigned channel        channel number
  540. ;*              unsigned *smpHandle     pointer to sample handle
  541. ;*
  542. ;* Returns:     MIDAS error code. Sample handle is written to *smpHandle;
  543. ;*
  544. ;\***************************************************************************/
  545.  
  546. GLOBAL  LANG dsmGetSample : _funct
  547.  
  548.  
  549.  
  550.  
  551. ;/***************************************************************************\
  552. ;*
  553. ;* Function:    int dsmChangeSample(unsigned channel)
  554. ;*
  555. ;* Description: Changes the sample used in a channel to the one specified
  556. ;*              by the channel's sample handle. Used only internally by
  557. ;*              other DSM functions, does no error checking.
  558. ;*
  559. ;* Input:       unsigned channel        channel number
  560. ;*
  561. ;* Returns:     MIDAS error code (does not fail)
  562. ;*
  563. ;\***************************************************************************/
  564.  
  565. GLOBAL  LANG dsmChangeSample : _funct
  566.  
  567.  
  568.  
  569.  
  570. ;/***************************************************************************\
  571. ;*
  572. ;* Function:    int dsmSetPosition(unsigned channel, unsigned position)
  573. ;*
  574. ;* Description: Sets the playing position from the beginning of the sample
  575. ;*
  576. ;* Input:       unsigned channel        channel number
  577. ;*              unsigned position       new playing position
  578. ;*
  579. ;* Returns:     MIDAS error code
  580. ;*
  581. ;\***************************************************************************/
  582.  
  583. GLOBAL  LANG dsmSetPosition : _funct
  584.  
  585.  
  586.  
  587.  
  588. ;/***************************************************************************\
  589. ;*
  590. ;* Function:    int dsmGetPosition(unsigned channel, unsigned *position)
  591. ;*
  592. ;* Description: Reads the current playing position
  593. ;*
  594. ;* Input:       unsigned channel        channel number
  595. ;*              unsigned *position      pointer to playing position
  596. ;*
  597. ;* Returns:     MIDAS error code. Playing position is written to *position.
  598. ;*
  599. ;\***************************************************************************/
  600.  
  601. GLOBAL  LANG dsmGetPosition : _funct
  602.  
  603.  
  604.  
  605.  
  606. ;/***************************************************************************\
  607. ;*
  608. ;* Function:    int dsmGetDirection(unsigned channel, int *direction)
  609. ;*
  610. ;* Description: Reads current playing direction
  611. ;*
  612. ;* Input:       unsigned channel        channel number
  613. ;*              int *direction          pointer to playing direction. 1 is
  614. ;*                                      forward, -1 backwards
  615. ;*
  616. ;* Returns:     MIDAS error code. Playing direction is written to *direction.
  617. ;*
  618. ;\***************************************************************************/
  619.  
  620. GLOBAL  LANG dsmGetDirection : _funct
  621.  
  622.  
  623.  
  624.  
  625. ;/***************************************************************************\
  626. ;*
  627. ;* Function:    int dsmSetPanning(unsigned channel, int panning)
  628. ;*
  629. ;* Description: Sets the panning position of a channel
  630. ;*
  631. ;* Input:       unsigned channel        channel number
  632. ;*              int panning             panning position (see enum sdPanning)
  633. ;*
  634. ;* Returns:     MIDAS error code
  635. ;*
  636. ;\***************************************************************************/
  637.  
  638. GLOBAL  LANG dsmSetPanning : _funct
  639.  
  640.  
  641.  
  642.  
  643. ;/***************************************************************************\
  644. ;*
  645. ;* Function:    int dsmGetPanning(unsigned channel, int *panning)
  646. ;*
  647. ;* Description: Reads the panning position of a channel
  648. ;*
  649. ;* Input:       unsigned channel        channel number
  650. ;*              int *panning            pointer to panning position
  651. ;*
  652. ;* Returns:     MIDAS error code. Panning position is written to *panning.
  653. ;*
  654. ;\***************************************************************************/
  655.  
  656. GLOBAL  LANG dsmGetPanning : _funct
  657.  
  658.  
  659.  
  660.  
  661. ;/***************************************************************************\
  662. ;*
  663. ;* Function:    int dsmMuteChannel(unsigned channel, int mute)
  664. ;*
  665. ;* Description: Mutes/un-mutes a channel
  666. ;*
  667. ;* Input:       unsigned channel        channel number
  668. ;*              int mute                muting status - 1 = mute, 0 = un-mute
  669. ;*
  670. ;* Returns:     MIDAS error code
  671. ;*
  672. ;\***************************************************************************/
  673.  
  674. GLOBAL  LANG dsmMuteChannel : _funct
  675.  
  676.  
  677.  
  678.  
  679. ;/***************************************************************************\
  680. ;*
  681. ;* Function:    int dsmAddSample(sdSample *sample, int copySample,
  682. ;*                  unsigned *smpHandle);
  683. ;*
  684. ;* Description: Adds a new sample to the DSM sample list and prepares it for
  685. ;*              DSM use
  686. ;*
  687. ;* Input:       sdSample *sample        pointer to sample information
  688. ;*                                          structure
  689. ;*              int copySample          copy sample data to a new place in
  690. ;*                                      memory? 1 = yes, 0 = no
  691. ;*              unsigned *smpHandle     pointer to sample handle
  692. ;*
  693. ;* Returns:     MIDAS error code. Sample handle for the new sample is written
  694. ;*              to *smpHandle
  695. ;*
  696. ;* Notes:       If copySample = 1, sample data must not be in EMS memory
  697. ;*
  698. ;\***************************************************************************/
  699.  
  700. GLOBAL  LANG dsmAddSample : _funct
  701.  
  702.  
  703.  
  704.  
  705. ;/***************************************************************************\
  706. ;*
  707. ;* Function:    int dsmRemoveSample(unsigned smpHandle)
  708. ;*
  709. ;* Description: Removes a sample from the sample list and deallocates it if
  710. ;*              necessary.
  711. ;*
  712. ;* Input:       unsigned smpHandle      sample handle returned by
  713. ;*                                      dsmAddSample()
  714. ;*
  715. ;* Returns:     MIDAS error code
  716. ;*
  717. ;\***************************************************************************/
  718.  
  719. GLOBAL  LANG dsmRemoveSample : _funct
  720.  
  721.  
  722.  
  723.  
  724. ;/***************************************************************************\
  725. ;*
  726. ;* Function:    int dsmMixData(unsigned numElems)
  727. ;*
  728. ;* Description: Mixes data to dsmMixBuffer.
  729. ;*
  730. ;* Input:       unsigned numElems       number of buffer elements to be mixed.
  731. ;*                                      In mono modes an "element" is an
  732. ;*                                      unsigned integer, and in stereo
  733. ;*                                      two.
  734. ;*
  735. ;* Returns:     MIDAS error code. Mixed data is written to *dsmMixBuffer.
  736. ;*
  737. ;\***************************************************************************/
  738.  
  739. GLOBAL  LANG dsmMixData : _funct
  740.  
  741.  
  742.  
  743.  
  744. ;/***************************************************************************\
  745. ;*
  746. ;* Function:    int dsmMix(unsigned channel, void *mixRoutine,
  747. ;*                  unsigned volume, unsigned numElems);
  748. ;*
  749. ;* Description: Mixes data for one channel. Used internally by dsmMixData().
  750. ;*
  751. ;* Input:       unsigned channel        channel number
  752. ;*              void *mixRoutine        pointer to low-level mixing routine
  753. ;*              unsigned volume         actual playing volume (volume in
  754. ;*                                      channel structure is ignored)
  755. ;*              unsigned numElems       number of elements to mix (see
  756. ;*                                      dsmMixData())
  757. ;*
  758. ;* Returns:     MIDAS error code
  759. ;*
  760. ;\***************************************************************************/
  761.  
  762. GLOBAL  LANG dsmMix : _funct
  763.  
  764.  
  765.  
  766.  
  767. ;/***************************************************************************\
  768. ;*
  769. ;* Function:    int dsmClearBuffer(unsigned numElems)
  770. ;*
  771. ;* Description: Clears the mixing buffer. Used only by dsmMixData().
  772. ;*
  773. ;* Input:       unsigned numElems       number of elements to clear
  774. ;*
  775. ;* Returns:     MIDAS error code.
  776. ;*
  777. ;\***************************************************************************/
  778.  
  779. GLOBAL  LANG dsmClearBuffer : _funct
  780.  
  781.  
  782.  
  783.  
  784. ;/***************************************************************************\
  785. ;*
  786. ;* Function:    int dsmSetLoopCallback(unsigned channel,
  787. ;*                  void CALLING (*callback)(unsigned channel));
  788. ;*
  789. ;* Description: Sets sample looping callback to a channel
  790. ;*
  791. ;* Input:       unsigned channel        channel number
  792. ;*              [..] *callback          pointer to callback function, NULL to
  793. ;*                                      disable callback
  794. ;*
  795. ;* Returns:     MIDAS error code
  796. ;*
  797. ;\***************************************************************************/
  798.  
  799. GLOBAL  LANG dsmSetLoopCallback : _funct
  800.  
  801.  
  802.  
  803.  
  804. ;/***************************************************************************\
  805. ;*
  806. ;* Function:    int dsmSetStreamWritePosition(unsigned channel,
  807. ;*                  unsigned position)
  808. ;*
  809. ;* Description: Sets the stream write position on a channel
  810. ;*
  811. ;* Input:       unsigned channel        channel number
  812. ;*              unsigned position       new stream write position
  813. ;*
  814. ;* Returns:     MIDAS error code
  815. ;*
  816. ;\***************************************************************************/
  817.  
  818. GLOBAL  LANG dsmSetStreamWritePosition : _funct
  819.  
  820.  
  821.  
  822.  
  823. ; Mixing routines:
  824. GLOBAL  LANG dsmMix8bitMonoMono : _funct
  825. GLOBAL  LANG dsmMix8bitMonoStereo : _funct
  826. GLOBAL  LANG dsmMix8bitStereoMono : _funct
  827. GLOBAL  LANG dsmMix8bitStereoStereo : _funct
  828. GLOBAL  LANG dsmMix16bitMonoMono : _funct
  829. GLOBAL  LANG dsmMix16bitMonoStereo : _funct
  830. GLOBAL  LANG dsmMix16bitStereoMono : _funct
  831. GLOBAL  LANG dsmMix16bitStereoStereo : _funct
  832.  
  833.  
  834.  
  835.  
  836. ;/***************************************************************************\
  837. ;*      enum dsmFunctIDs
  838. ;*      ----------------
  839. ;* Description: ID numbers for DSM functions
  840. ;\***************************************************************************/
  841.  
  842. ENUM    dsmFunctIDs \
  843. ID_dsmInit = ID_dsm, \
  844. ID_dsmClose, \
  845. ID_dsmGetMixRate, \
  846. ID_dsmOpenChannels, \
  847. ID_dsmCalcVolTable, \
  848. ID_dsmCloseChannels, \
  849. ID_dsmClearChannels, \
  850. ID_dsmMute, \
  851. ID_dsmPause, \
  852. ID_dsmSetMasterVolume, \
  853. ID_dsmGetMasterVolume, \
  854. ID_dsmSetAmplification, \
  855. ID_dsmGetAmplification, \
  856. ID_dsmPlaySound, \
  857. ID_dsmReleaseSound, \
  858. ID_dsmStopSound, \
  859. ID_dsmSetRate, \
  860. ID_dsmGetRate, \
  861. ID_dsmSetVolume, \
  862. ID_dsmGetVolume, \
  863. ID_dsmSetSample, \
  864. ID_dsmGetSample, \
  865. ID_dsmChangeSample, \
  866. ID_dsmSetPosition, \
  867. ID_dsmGetPosition, \
  868. ID_dsmSetPanning, \
  869. ID_dsmGetPanning, \
  870. ID_dsmMuteChannel, \
  871. ID_dsmAddSample, \
  872. ID_dsmRemoveSample, \
  873. ID_dsmMixData, \
  874. ID_dsmMix, \
  875. ID_dsmMixMoNormal, \
  876. ID_dsmMixStNormal, \
  877. ID_dsmClearBuffer, \
  878. ID_dsmStartStream, \
  879. ID_dsmStopStream, \
  880. ID_dsmSetLoopCallback, \
  881. ID_dsmSetStreamWritePosition
  882.  
  883.  
  884.  
  885.  
  886. ;* $Log: dsm.inc,v $
  887. ;* Revision 1.5  1997/01/16 18:41:59  pekangas
  888. ;* Changed copyright messages to Housemarque
  889. ;*
  890. ;* Revision 1.4  1997/01/16 18:19:10  pekangas
  891. ;* Added support for setting the stream write position.
  892. ;* Stream data is no longer played past the write position
  893. ;*
  894. ;* Revision 1.3  1996/06/26 19:15:13  pekangas
  895. ;* Added sample loop callbakcs
  896. ;*
  897. ;* Revision 1.2  1996/05/28 20:30:22  pekangas
  898. ;* Made new mixing routines GLOBAL
  899. ;*
  900. ;* Revision 1.1  1996/05/22 20:49:33  pekangas
  901. ;* Initial revision
  902. ;*